﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Hxsoft.Web;
using Hxsoft.AppV1.Module;

namespace Hxsoft.AppV1._Controls
{
	public partial class ResourceBrowser : Hxsoft.AppV1.Page
	{
		public static string TitleText
		{
			get { return Res.ResourceBrowser_Title; }
		}

		#region
		private Guid? _globalId;
		public Guid GlobalId
		{
			get
			{
				if (_globalId == null)
					_globalId = new Guid(Request.QueryString["GlobalId"]);
				return _globalId.Value;
			}
		}
		private int? _SiteId;
		public int? SiteId
		{
			get {
				if (_SiteId == null)
					_SiteId = IntExtensions.ParseOrNull(Request.QueryString["SiteId"]);
				return _SiteId;
			}
		}

		private string _infoType;
		public string InfoType
		{
			get
			{
				if (_infoType == null)
					_infoType = Request.QueryString["InfoType"];
				return _infoType;
			}
		}

		private string _callbackFunction;
		public string CallbackFunction
		{
			get
			{
				if (_callbackFunction == null)
					_callbackFunction = Request.QueryString["CallbackFunction"];
				if (string.IsNullOrEmpty(_callbackFunction))
					_callbackFunction = "__Callback";
				return _callbackFunction;
			}
		}
		#endregion

		protected void CtrSelector_DataBinding(object sender, EventArgs e)
		{
			CtrSelector.GlobalId = GlobalId;
			CtrSelector.InfoType = InfoType;
			CtrSelector.SiteId = SiteId;
			CtrSelector.ClientCallbackFunction = CallbackFunction;
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
				this.DataBind();
		}
	}
}
